package com.shoux.api.web.service.apiData.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.shoux.api.tools.StringUtils;
import com.shoux.api.web.entity.DicFieldValuesEntity;
import com.shoux.api.web.entity.apiData.BasiclistEntity;
import com.shoux.api.web.dao.apiData.BasiclistMapper;
import com.shoux.api.web.entity.query.CompanyQuery;
import com.shoux.api.web.service.apiData.BasiclistService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 企业照面信息 服务实现类
 * </p>
 *
 * @author xiaoZhi
 * @since 2022-03-25
 */
@Service
public class BasiclistServiceImpl extends ServiceImpl<BasiclistMapper, BasiclistEntity> implements BasiclistService {

    @Resource
    private BasiclistMapper basiclistMapper;

    @Override
    public BasiclistEntity getCompanyInfoByName(CompanyQuery companyQuery) {
        LambdaQueryWrapper<BasiclistEntity> queryWrapper = Wrappers.lambdaQuery(BasiclistEntity.class)
                .eq(BasiclistEntity::getEnterprisename1, StringUtils.replaceAllTo(companyQuery.getName()));
        return basiclistMapper.selectOne(queryWrapper);
    }

    @Override
    public List<String> getCompanyNameByLikeName(String name) {
        return basiclistMapper.getCompanyNameByLikeName(name);
    }
}
